package com.hilin.base.conf;

import com.baidu.aip.speech.AipSpeech;
import lombok.Data;
import org.json.JSONObject;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.context.annotation.Configuration;

@RefreshScope
@Data
@Configuration
@ConfigurationProperties(prefix = "com.hilin.base")
public class ServerConfig {

    /**
     * token过期时间，单位秒
     * 默认一天
     */
    private long tokenExp = 86400;

    /**
     * 是否token覆盖
     * 同一账号多次登录时，会把前一次登录的token失效
     * 也就是单设备登录
     */
    private Boolean tokenCover = false;

    /**
     * 允许同时登录账号数量
     * 如果开启token覆盖，则该参数失效
     */
    private Integer maxSameTimeNum;

    /**
     * 加密字符串长度，默认24
     */
    private int secretLen = 24;

    public static void main(String[] args) {
        // 初始化一个AipSpeech
        AipSpeech client = new AipSpeech("25387741", "EssxaNzr989MGWVNFboCLcgV", "DPBqqux9EYbi01zLEIyFqlHwMzXyY0sF");
        String path = "C:\\Users\\qhl\\Desktop\\so.wav";
        JSONObject asrRes = client.asr(path, "wav", 16000, null);
        System.out.println(asrRes.toString());
    }

}
